<script type="text/javascript" src="<?php echo ThemePath(); ?>/js/jquery.blockUI.js"></script>
<section id="teach-tab">
    <div class="row">
        <div class="col-lg-12 mopo">
            <hr class="ilm">
            <ul class="list-unstyled teach-button ">
                <li><a href="javascript:void(0);"  onclick="checkProfile('Classes/Create');">Create a Workshop</a></li>
                <li><a href="javascript:void(0);"  onclick="checkProfile('Courses/Create');">Create a Course</a></li>
            </ul>
        </div>
        <div class="errorMessage" id="profileresult"></div>
    </div>

    <div class="clearfix"></div> 
    <div class="gap2"></div>
    <div class="clearfix"></div>
    <div class="row">
        <div class="col-lg-3 col-sm-2 col-md-3  mopo">
            <h1>Workshop and Course</h1>
        </div>

        <div class="col-lg-9 hidden-xs">
            <div class="row">

                <div class="col-lg-3 col-sm-1 col-md-3 mopo sort-title">
                    Sort By
                </div>

                <div class="col-lg-3 col-md-3 col-sm-3">
                    <div class="input-group">
                        <select class="form-control selectsort" id='selectClassCoursetype'>
                            <option value="">Select Type</option>
                            <option value="1">Workshop</option>
                            <option value="2">Courses</option>                            
                        </select>
                    </div>
                </div>

                <div class="col-lg-3 col-md-3 col-sm-3">
                    <div class="input-group">


                        <select class="selectsort form-control" id="sort_upcooming_type" name="sort_class_type">
                            <option value="">Select Class</option>
                            <option value="1">Current Class</option>
                            <option value="2">Upcoming Class</option>
                            <option value="3">Previous Class</option>
                        </select>

                    </div>
                </div>

                <div class="col-lg-3 col-md-3 col-sm-3">
                    <div class="input-group">
                        <select class="form-control selectsort" id='sort_location' name="sort_location">
                            <option value=''>Select A Location</option>
                            <?php
                            foreach ($classVenueVals as $classVenueVal) {
                                echo '<option value=' . $classVenueVal->id . '>' . $classVenueVal->venue_locality . '</option> ';
                            }
                            ?>
                        </select>
                    </div>
                </div>

            </div>

        </div>
    </div>

    <div class="clearfix"></div>

    <hr class="ilm"><!-- separator -->

    <div class="row">
        <?php
        $this->widget('zii.widgets.CListView', array(
            'dataProvider' => $dataProvider,
            'id' => 'ajaxListView',
            'summaryText' => '',
            'itemView' => '//classes/_view',
                //'ajaxUpdate' => true,
        ));
        ?>
    </div>
    <div class="clearfix"></div> 

    <div class="gap2"></div>
    <div class="gap2"></div>

    <div class="clearfix"></div>



    <div class="gap2"></div>
    <div class="gap2"></div>

</section>



<?php
Yii::app()->clientScript->registerScript('search', "var ajaxUpdateTimeout;
    var ajaxRequest;
    $('.selectsort').change(function(){
 getAjaxListUpdate('ajaxUpdateTimeout','ajaxRequest');
    });
"
);
?>
<script type="text/javascript">

                    function getAjaxListUpdate(ajaxUpdateTimeout, ajaxRequest) {
                        var workshop = $("#selectClassCoursetype").val();                      
                        var sort_locationval = $('#sort_location').val();
                        var sort_class_type = $('#sort_upcooming_type').val();
                        ajaxRequest = '&location=' + sort_locationval + '&classType=' + sort_class_type + '&courseClass=' + workshop;
                        clearTimeout(ajaxUpdateTimeout);
                        ajaxUpdateTimeout = setTimeout(function() {
                            imageloding();
                            $.fn.yiiListView.update(
                                    'ajaxListView',
                                    {data: ajaxRequest}

                            )
                        },
                                100);
                        $(document).ajaxStop($.unblockUI);
                    }

</script>
